<template>
    <el-table :data="article" border style="width: 100%" :cell-style="{ height: '65px' }" v-loading="loading">
        <el-table-column label="封面" width="240" :#empty="nodata">
            <template #default="scope">
                <img :src="scope.row.face" style="width: 100%;max-height: 200px;" />
            </template>
        </el-table-column>
        <el-table-column prop="title" label="标题" width="180" />
        <el-table-column prop="time" label="上传时间" width="180" />
        <el-table-column prop="author" label="作者" width="180" />
        <el-table-column prop="tag" label="标签" width="100" />
        <el-table-column prop="checktime" label="审核时间" width="180" />
        <el-table-column prop="admin" label="审核管理员" width="100" />
        <el-table-column prop="state" label="审核状态" />
    </el-table>
    <pageComponents2Class @pageChange="handlePageChange" @siezsChange="handleSizesChange" :max=length
        style="margin: 10px 0px;" />
</template>

<script>
import { ref } from 'vue';
import $ from 'jquery';
import pageComponents2Class from '@/components/global/pageComponents2Class.vue';
import { useStore } from 'vuex';
export default {
    name: "checkHistory",
    components: {
        pageComponents2Class,
    },
    setup() {
        const store = useStore();
        let article = ref();
        let nowPage = ref(1);
        let nowSizes = ref(10);
        let length = ref('');

        let loading = ref(true);

        let getInfo = () => {
            $.ajax({
                type: "post",
                url: "http://124.221.73.180:3001/check/showAllArticle/",
                headers: {
                    "satoken": store.state.admin.token,
                },
                data: {
                    page: nowPage.value,
                    sizes: nowSizes.value,
                },

                success(resp) {
                    //setTimeout(() => {
                    loading.value = false;
                    article.value = resp.article;
                    length.value = resp.length;
                    //}, 2000)

                }
            });
        }
        getInfo();

        let handlePageChange = (t) => {
            nowPage.value = t;
            console.log("pageChange");
            getInfo();
        }
        let handleSizesChange = (sizes) => {
            nowSizes.value = sizes;
            console.log("sizesChange");
            getInfo();
        }

        return {
            handlePageChange,
            handleSizesChange,
            nowPage,
            length,
            nowSizes,

            getInfo,
            article,

            loading,

        }
    }
}

</script>

<style scoped>
/deep/ el-table__body-wrapper {
    height: 0px;
}
</style>